// ignore_for_file: constant_identifier_names, avoid_print

import 'package:airbnb_clone/internal/http/request/article_comment_create_request.dart';

import '../../../models/response.dart';
import '../core/hi_net.dart';
import '../request/base_request.dart';

/// 与服务端通信 , 数据交互和持久化的操作都放在 DAO 层:
class ArticleCommentCreateDao {
  static create(int articleId, String context) async {
    return await _send(articleId, context);
  }

  static _send(
    int articleId,
    String context,
  ) async {
    BaseRequest request;

    request = ArticleCommentCreateRequest();
    // 为 request 添加参数:
    request.addJson("article_id", articleId).addJson("context", context);
    request.setJsonHeader();
    var result = await HiNet.getInstance().fire(request);

    TiebaResponse response = TiebaResponse.fromMap(result);
    print(result);
    return response;
  }
}
